package com.cms.web.queryAnalyse;

import java.util.List;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.mrp.biz.sysconfigure.sysConfigureServiceMgr;
import com.mrp.persistence.sysConfigure.department.bean.HYBMZD;
import com.mrp.persistence.sysConfigure.user.bean.HYZGZD;
import com.web.BaseController;

@Controller
@RequestMapping(value="/userQueryAnalyse")
public class EMPUserQueryAnalyseController extends BaseController{
	@Autowired
	private                   sysConfigureServiceMgr                              sysConfigureMgr;

	@Autowired
	public HttpSession session;

	@RequestMapping("/user")
	public String userList(Model model) {
		List<HYBMZD> hybmList = sysConfigureMgr.searchHYBMZD(0, 100);
		model.addAttribute("hybmList", hybmList);
		model.addAttribute("F_SXBM", "{F_BMBH}");
		return "/cms/queryAnalyse/user/list";
	}
	
	/**
	 * 用户
	 * @param model
	 * @return
	 */
	@RequestMapping("/user/{F_SXBM}")
	public String userList(@PathVariable("F_SXBM") String F_SXBM, Model model) {
		List<HYZGZD> userList = sysConfigureMgr.searchHYZG(F_SXBM, 0, 100);
		model.addAttribute("userList", userList);
		model.addAttribute("F_SXBM", F_SXBM);
		return "/cms/queryAnalyse/user/userList";
	}
	
	@RequestMapping("/user/search/{F_SXBM}")
	public String userList(@PathVariable("F_SXBM") String F_SXBM, @RequestParam String keywords, Model model) {
		List<HYZGZD> userList = sysConfigureMgr.searchHYZG("", keywords, 0, 100);
		model.addAttribute("userList", userList);
		model.addAttribute("F_SXBM", F_SXBM);
		return "/cms/queryAnalyse/user/userList";
	}
}
